home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
9-Digit Zip Code Directory
/
9-Digit Zip Code Directory (American Business Information) (ABIZIP-12).ISO
/
z4src.zip
/
CLLZW.HPP
< prev
next >
Wrap
C/C++ Source or Header
|
1993-05-30
|
3KB
|
104 lines
//----------------------------------------------------------------------------
// MODULE DESCRIPTION
//
// Module: cllzw.hpp
// Title: C++ Class Libraries
// Notice: John M. Weeder
// Copyright (c) 1993. All rights reserved.
// This module contains proprietary information and should be
// treated as confidential.
//
//----------------------------------------------------------------------------
// MAINTENANCE HISTORY
//
// $Workfile$
// $Revision$
// $Author$
// $Date$
// $Log$
//
//----------------------------------------------------------------------------
// MODULE NARRATIVE
//
// This module contains code for the class CL_LZW.
//
// The code in this module may be written in C++ or C.
//
// This module is portable to:
// DOS 3.X+
// MS Windows 3.X+
// OS/2 2.X+
// OS/2 2.0 PM
//
// The following compilers are supported:
// MSC 6.0A
// MSC/C++ 7.0
// Borland C++ 3.1 for DOS
// Borland C++ 1.0 for OS/2 2.X
//
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
// Constants and structures
//----------------------------------------------------------------------------
#define LZW_SYMBOLS (4096) // Maximum sybols (0-255 are ASCII)
struct LZW_SYM // Symbol
{
SIZET cLen; // Length of expanded symbol in bytes
SHORT sFirst; // First symbol in string
SHORT sNext; // Next string starting with same char
SHORT sSym[2]; // Composite Symbol
};
typedef VOID (FN_E *PFNLZW)(LONG, LONG);
//----------------------------------------------------------------------------
// Class CL_LZW
//----------------------------------------------------------------------------
CLASSDEF(CL_LZW);
#define CL_LZW_PARENT CL_OBJECT
class CLASSTYPE CL_LZW : public CL_LZW_PARENT
{
SIZET cSym;
LZW_SYM asym[LZW_SYMBOLS];
PBYTE pbIn;
SIZET cbIn;
PBYTE pbOut;
SIZET cbOut;
SIZET cbData;
SIZET cBitsLeft;
SIZET cBits;
public:
FN_M CL_LZW();
FN_M CL_LZW(RCCL_LZW);
virtual FN_M ~CL_LZW();
SIZET FN_M Decode(PBYTE, SIZET, PBYTE, SIZET);
BOOL FN_M DecodeFile(PCSZ, PCSZ = NULL, PFNLZW = NULL);
virtual BOOL FN_M Destroy(BOOL = TRUE);
SIZET FN_M Encode(PBYTE, SIZET, PBYTE, SIZET);
BOOL FN_M EncodeFile(PCSZ, PCSZ = NULL, PFNLZW = NULL);
virtual BOOL FN_M Initialize(SHORT = CL_INIT_ALL);
RCCL_LZW FN_M operator=(RCCL_LZW);
virtual BOOL FN_M Retrieve(PCSZ, PCSZ = NULL);
virtual BOOL FN_M Store(PCSZ, PCSZ = NULL);
#if COMPILE_DEBUG
static BOOL FN_M Test(SHORT = 0);
#endif
protected:
private:
VOID FN_M Add(SHORT, SHORT);
BOOL FN_M Expand(SHORT);
BOOL FN_M IsMatch(PBYTE, SHORT);
SHORT FN_M Read();
BOOL FN_M Write(SHORT);
};
//----------------------------------------------------------------------------
//------------------------------- End of File --------------------------------
//----------------------------------------------------------------------------